package com.example.service.Impl;

import com.example.mapper.BlogMapper;
import com.example.model.BlogInfo;
import com.example.service.BlogService;
import org.apache.el.parser.BooleanNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * Description:
 * User: 阿宾
 * Date: 2025-05-14
 * Time: 19:28
 */
@Service
public class BlogServiceImpl implements BlogService {
    @Autowired
    private BlogMapper blogMapper;

    @Override
    public List<BlogInfo> getList() {
        return blogMapper.selectAll();
    }

    @Override
    public BlogInfo getBlogDetail(Integer blogId) {
        return blogMapper.selectById(blogId);
    }

    @Override
    public Boolean addBlog(BlogInfo blogInfo) {
        Integer result = blogMapper.insertBlog(blogInfo);
        return result == 1;
    }

    @Override
    public Boolean deleteBlog(BlogInfo blogInfo) {
        Integer result = blogMapper.updateBlog(blogInfo);
        return result == 1;
    }

    @Override
    public Boolean updateBlog(BlogInfo blogInfo) {
        Integer result = blogMapper.updateBlog(blogInfo);
        return result == 1;
    }

}
